package com.auth.custom;

/**
 * @Author:Tangjiachang
 * @Date 2023/7/23
 * @Description: 获取当前用户信息
 */
public class LoginUserInfoHelper {
    private static final ThreadLocal<Long> USER_ID = new ThreadLocal<>();
    private static final ThreadLocal<String> USER_NAME = new ThreadLocal<>();
    public static void setUseId(Long thisUserId) {
        USER_ID.set(thisUserId);
    }
    public static void setUsername(String thisUsername) {
        USER_NAME.set(thisUsername);
    }
    public static Long getUserId() {
        return USER_ID.get();
    }
    public static String getUsername() {
        return USER_NAME.get();
    }

    public static void removeAll() {
        USER_ID.remove();
        USER_NAME.remove();
    }
}
